<?php
$this->load->helper('form');
$this->load->helper('captcha');

echo form_open('user/register');

// captcha
$vals = array(
	'img_path' => './captcha/',
	'img_url' => base_url().'captcha/',
	'img_width' => 150,
	'img_height' => 40
);
$cap = create_captcha($vals);
$data = array(
	'captcha_time' => $cap['time'],
	'ip_address' => $this->input->ip_address(),
	'word' => $cap['word']
);
$this->db->insert('captcha', $data);
?>

<table class='center top general_table'>
	<tr>
		<td>Username:</td>
		<td>
			<?php echo form_error('username'); ?>
			<?php echo form_input('username', $this->input->post('username')); ?>
		</td>
	</tr>
	<tr>
		<td>Password:</td>
		<td>
			<?php echo form_error('password'); ?>
			<?php echo form_password('password', $this->input->post('password')); ?>
		</td>
	</tr>
	<tr>
		<td>Password Confirm:</td>
		<td>
			<?php echo form_error('password2'); ?>
			<?php echo form_password('password2', $this->input->post('password2')); ?>
		</td>
	</tr>
	<tr>
		<td>
			Enter the word in the image:
		</td>
		<td>
			<?php echo form_error('captcha'); ?>
			<?php if($invalid_captcha_text) echo '<div class="form_error">The image word did not match.</div>'; ?>
			<?php echo form_input('captcha', $this->input->post('captcha')); ?>
			<?php echo $cap['image']; ?>
		</td>
	</tr>
	<tr>
		<td colspan=2>
			<?php echo form_submit('register_submit', 'Register'); ?>
		</td>
	</tr>
	
</table>

<?php
echo form_close();